#include "stdio.h"
#include "string.h"
int main()
{
    int i,j,n=0;
    char w[10000][10],temp[10];
    FILE *fp;
    if((fp=fopen("case1.in.txt","r"))==NULL) return 1;
    while(fscanf(fp,"%s",w[n])!=EOF) n++;
    fclose(fp);
    for(i=0;i<n-1;i++)
    {
        for(j=0;j<n-i-1;j++)
        {
            if(strcmp(w[j],w[j+1])>0)
            {
                strcpy(temp,w[j]);
                strcpy(w[j],w[j+1]);
                strcpy(w[j+1],temp);
            }
        }
    }
    if((fp=fopen("answer.txt","w"))==NULL) return 1;
    for(i=0;i<n;i++)
    {
        fprintf(fp,"%s\n",w[i]);
    }
    fclose(fp);
    return 0;
}
